<?php

namespace app\services;

use plugin\admin\app\model\Goods;
use plugin\admin\app\model\GoodsSKU;

class StockService
{
    public static function reduce($data)
    {
        $skuInfo = GoodsSKU::where('id', $data['sku_id'])->first();
        Goods::where('id', $skuInfo['goods_id'])->decrement('stock', $data['count']);
        GoodsSKU::where('id', $data['sku_id'])->decrement('stock', $data['count']);
    }
}